package com.malljelly.study.entity;

import lombok.Data;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * Created by 骑着蜗牛去旅行 on 2018/8/12.
 */
@MappedSuperclass  //不加这个注解找不到id
@Data  //setxxx和getxxx
public class BaseEntity  implements Serializable {
    /**
     * 主键ID
     */
    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Long id;
    /**
     * 创建时间
     */
    private Timestamp createTime =new Timestamp(System.currentTimeMillis());
    /**
     * 修改时间
     */
    @UpdateTimestamp
    private Timestamp updateTime;

}
